﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Ribbon_SmallItem : UserControl
{
    private string _clientclick = null;
    public event EventHandler Click = null;

    /// <summary>
    /// Sets or Gets the Text
    /// </summary>
    public string Text
    {
        get { return this.lb_text.Text; }
        set { this.lb_text.Text = value; }
    }

    /// <summary>
    /// Sets or Gets the Javascript code to run when item clicked
    /// </summary>
    public string OnClientClick
    {
        get { return this._clientclick; }
        set { this._clientclick = value; this.div_item.Attributes.Add("onclick", value + "; return false;"); }
    }

    /// <summary>
    /// Sets or Gets the icon url
    /// </summary>
    public string ImageUrl
    {
        get { return this.Image1.ImageUrl; }
        set { this.Image1.ImageUrl = value; }
    }

    /// <summary>
    /// Sets the tooltip
    /// </summary>
    public string Tooltip
    {
        set { this.div_item.Attributes["title"] = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (_clientclick != null)
        {
            //this.lb_text.OnClientClick = _clientclick + "; return false;";
            //this.lb_img.OnClientClick = _clientclick + "; return false;";
        }
    }


    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        if (Click != null)
        {
            Click(this, e);
        }
    }
}
